<template>
	<div>
		<Modal :title="scanTitle" v-model="isShowScanModal" @on-ok="onOk" @on-cancel="cancel" class="vertical-center-modal">
			<RadioGroup v-model="codeType" vertical>
				<Radio label="qrcode">
					<Icon type="social-apple"></Icon>
					<span>二维码</span>
				</Radio>
				<Radio label="qucode">
					<Icon type="social-android"></Icon>
					<span>条形码</span>
				</Radio>
			</RadioGroup>
		</Modal>
	</div>
</template>

<script>
export default {
	data() {
		return {
			codeType: 'qrcode',
			isShowScanModal: false,
			scanTitle: this.$t('scantitle.title')
		};
	},
	methods: {
		onOk() {
			this.isShowScanModal = false;
			this.$emit('userChooseCode', this.codeType);
		},
		cancel() {
			this.$parent.cancelInstructionMessage();
			this.$parent.sendConfirmationMessageToAgent({ answer: 'reject' });
		}
	}
};
</script>

<style scoped>
.vertical-center-modal {
	display: flex;
	align-items: center;
	justify-content: center;
}
.ivu-modal {
	top: 0;
}
</style>
